package cn.xaut.XAUT迎春杯预热;

import java.util.Scanner;

/**
 * D - 启蒙练习-鸡兔同笼
 */
public class demoD {
    
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int m = input.nextInt();
        
        int x = 2 * n - m / 2, y = n - x;
        System.out.println(x + " " + y);
    }
}
